/*
 * FlightDatabase.h
 *
 *  Created on: May 8, 2014
 *      Author: alexander
 */

#ifndef FLIGHTDATABASE_H_
#define FLIGHTDATABASE_H_

#include <string>
#include <vector>
#include <map>

#include "Flight.h"

class FlightDatabase
{
public:
	static FlightDatabase getInstance();
	void findFlights(const std::string& where = "", int month = 0);
	void findCheapest(const std::string& where = "", int month = 0) const;
	void findCheapest(int month) const;
	void saveData() const;

	void loadFromFS();

	virtual ~FlightDatabase() { isInstanciated = false; }

private:
	std::map<std::string, std::map<std::string, Flight>> flights;
	void addFlights(const std::string& where, const std::map<std::string, Flight>& newFlights);

	FlightDatabase() {};
	static bool isInstanciated;// = false;
};

#endif /* FLIGHTDATABASE_H_ */
